package edu.pku.sei.modeler.neditor.part.policy;

import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.Request;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.editpolicies.XYLayoutEditPolicy;
import org.eclipse.gef.requests.CreateRequest;

import edu.pku.sei.modeler.neditor.ui.CommandCreationFactory;


public class NodeContainerLayoutEditPolicy extends XYLayoutEditPolicy {

	protected Command getCreateCommand(CreateRequest request) {
		return CommandCreationFactory.getCreateCommand(this.getHost(),request);
		//return null;
	}

	protected Command getDeleteDependantCommand(Request request) {
		return null;
	}

	protected Command createAddCommand(EditPart child, Object constraint) {
		return CommandCreationFactory.getRedirectedChangeConstraintCommand(this.getHost(), child.getParent(), child,(Rectangle)constraint);
	}

	protected Command createChangeConstraintCommand(EditPart child, Object constraint) {
		return CommandCreationFactory.getChangeConstraintCommand(this.getHost(),child, (Rectangle)constraint);
	}
}
